package com.tian.factory.simple;

import com.tian.factory.simple.product.IProduct;
import com.tian.factory.simple.product.OneProduct;
import com.tian.factory.simple.product.ThreeProduct;
import com.tian.factory.simple.product.TwoProduct;

/**
 * @author tiansongtao, Email:tiansongtao@up366.com
 * @date 2020/12/23 20:38
 */
public class SimpleFactory {

    public static final int SIMPLE_CREATE_ONE = 1;
    public static final int SIMPLE_CREATE_TWO = 2;
    public static final int SIMPLE_CREATE_THREE = 3;

    public static IProduct createProduct(int type) {
        switch (type) {
            case SIMPLE_CREATE_ONE:
                return new OneProduct();
            case SIMPLE_CREATE_TWO:
                return new TwoProduct();
            case SIMPLE_CREATE_THREE:
                return new ThreeProduct();
            default:
                return null;
        }
    }
}
